# Time  ：2021/6/11 13:48
# Author：Houtaroy
from flask_jwt_extended import get_jwt_identity


class AuthUtil:

    @staticmethod
    def current_user():
        try:
            return get_jwt_identity()
        except RuntimeError:
            return None

    @staticmethod
    def current_user_id():
        user = AuthUtil.current_user()
        return user['id'] if user is not None else None
